package xyz.chenyongpeng.userconsumerdubbo.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.chenyongpeng.entity.ZsVisitors;
import xyz.chenyongpeng.service.IZsVisitorsService;
import xyz.chenyongpeng.to.VisitorTo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class VisitorsService {

    @Autowired
    private IZsVisitorsService zsVisitorsService;

    public List<VisitorTo> getListByUId(String u_id,String limit){
        Map<String,Object> parms = new HashMap<>();
        parms.put("u_id", u_id);
        parms.put("limit", limit);
        return zsVisitorsService.getListByUId(parms);
    }

    public int getCountByUId(String u_id){
        return zsVisitorsService.count(new QueryWrapper<ZsVisitors>().eq("u_id", u_id));
    }

    public int addVisitors(Map<String,Object> parms){
        return zsVisitorsService.addVisitors(parms);
    }
}
